<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .xxx {
        color: red;
      }
    </style>
  </head>
  <body>
    <div id="root"></div>

    <script src="./js/react.development.js"></script>
    <script src="./js/react-dom.development.js"></script>
    <script src="./js/babel.min.js"></script>

    <script type="text/babel">
      const hobby = ['抽烟', '喝酒', '找富婆']

      // const list = hobby.map((item) => {
      //   return <li>{item}</li>
      // })
      // console.log(list)

      {
        /*[<li>抽烟</li>,<li>喝酒</li>,<li>找富婆</li>]*/
      }
      const ul = (
        <ul>
          {hobby.map((item, index) => {
            // key要加到jsx的根标签上. 加key之后,react底层执行性能会更好
            return <li key={index}>{item}</li>
          })}
        </ul>
      )
      ReactDOM.render(ul, document.getElementById('root'))
    </script>
  </body>
</html>
